﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using System.Security.Claims;
using System;

namespace NewsWebsite.Controllers
{
    [ApiController]
    public class BaseApiController : ControllerBase
    {
        protected string GetReqUrl()
        {
            var url = Request.Path;
            if (Request.QueryString.HasValue) url += Request.QueryString.ToString();
            return url;
        }
        /// <summary>
        /// 获取授权用户id
        /// </summary>
        /// <returns></returns>
        protected Guid getUserId()
        {
            if (!User.Identity.IsAuthenticated) return Guid.Empty;
            return Guid.Parse(User.Identity.Name);
        }
       
    }
}
